Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add readiness and liveness probes to crossplane #4748

Merged
merged 2 commits into from
Oct 9, 2023

Conversation

phisco
Copy link
Contributor

@phisco phisco commented Oct 9, 2023

Description of your changes

Fixes part of E2E flakiness we are observing, avoiding Crossplane to be marked as Ready before the Webhook server is actually ready. If webhook is not enabled (webhooks.enabled=false) both probes are just set to the default no-op.

I have:

  • Read and followed Crossplane's contribution process.
  • Added or updated unit and E2E tests for my change.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR, if necessary.
  • Opened a PR updating the docs, if necessary.

Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
@phisco phisco requested review from negz and turkenh October 9, 2023 07:35
@phisco phisco requested review from a team as code owners October 9, 2023 07:35
Copy link
Member

@turkenh turkenh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @phisco 🙌

cmd/crossplane/core/core.go Outdated Show resolved Hide resolved
return errors.Wrap(err, "cannot create ping health check")
}

// Add probes waiting for the webhook server if webhooks are enabled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to add something like a started checker for the controllers?
Could it be helpful to report as ready only after controllers are operational, e.g. after acquiring the lease successfully.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also check/do that only after we're aware of a use case that it would help.
Feel free to ignore for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we could definitely do something, but I couldn't find many examples of other projects doing much more than this. Acquiring the lease could not be the right condition though as we want to support multiple replicas serving webhooks, @sttts was talking about caches being populated, any additional hint/pointer to prior art?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think readiness is connected to leader election. It's a blackbox property whether the pod is ready to serve traffic (via the webhook). Controllers are always async. No need to wait for them. What does waiting for them even mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, @sttts. What did you have in mind by "waiting for informers" here? I was referring to that when I asked if you had any prior reference implementation to share.

Copy link
Contributor

@sttts sttts Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If functionality of the process depends on informers to sync, then they should be part of readiness. E.g. admission in kube cannot work correctly without synced informers. Hence, the kube-apiserver might return inconsistent results prior to that.

Don't think it matters here much.

You could delay readiness by mgr.GetCache().WaitForSync() or so.

Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
@phisco phisco merged commit 711e4b0 into crossplane:master Oct 9, 2023
15 of 16 checks passed
@diegoavitorino
Copy link

diegoavitorino commented Mar 26, 2024

Hi, I still didn't understood how fix the error Internal error occurred: failed calling webhook "compositions.apiextensions.crossplane.io": failed to call webhook: Post "https://crossplane-webhooks.crossplane-system.svc:9443/validate-apiextensions-crossplane-io-v1-composition?timeout=10s": context deadline exceeded

Just to make sure endpoint is responding:

/ # curl https://crossplane-webhooks.crossplane-system:9443/validate-apiextensio
ns-crossplane-io-v1-composition?
curl: (60) SSL certificate problem: self-signed certificate
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
/ #
/ #
/ # curl https://crossplane-webhooks.crossplane-system:9443/validate-apiextensio
ns-crossplane-io-v1-composition? --insecure
{"response":{"uid":"","allowed":false,"status":{"metadata":{},"message":"contentType=, expected application/json","code":400}}}
/ #

What I need to do to fix it?

Thanks

@phisco
Copy link
Contributor Author

phisco commented Mar 26, 2024

@diegoavitorino please open an issue with more details about your setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants